package com.huawei.appmarket.framework.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatImageView;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import o.dky.d;

public class NoAdaptRenderImageView extends AppCompatImageView implements RenderListener {
    public NoAdaptRenderImageView(Context context) {
        this(context, null);
    }

    public NoAdaptRenderImageView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public NoAdaptRenderImageView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˋ(context);
    }

    private void ˋ(Context context) {
        int color = context.getResources().getColor(d.ˋ);
        setImageTintList(new ColorStateList(new int[][]{new int[0]}, new int[]{color}));
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        if (rule != null) {
            CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.FONT_COLOR);
            if (propertyValue instanceof CSSMonoColor) {
                int color = ((CSSMonoColor) propertyValue).getColor();
                setImageTintList(new ColorStateList(new int[][]{new int[0]}, new int[]{color}));
            }
        }
        return true;
    }
}
